
let baseURL = 'https://api.it120.cc/conner';
// 判断是否处于 h5 且 是开发环境 baseURL 变成 /conner
// // #ifdef H5
// 	if (process.env.NODE_ENV === "development") {
// 		baseURL = '/conner'
// 	}
// // #endif

// 或者

if (process.env.NODE_ENV === "development" && process.env.VUE_APP_PLATFORM ==='h5') {
	baseURL = '/conner'
}
const request = (url, config = {}) => {
	return new Promise((resolve, reject) => {
		// 发送请求
		uni.showLoading({
			title:'加载中...'
		})
		uni.request({
			url: baseURL + url,
			method: config.method||'GET',
			data: config.data || {},
			header: {
				'content-type': 'application/x-www-form-urlencoded'
			},
			success: res => {
				resolve(res)
			},
			fail: err => {
				reject(err)
			},
			complete: () => {
				uni.hideLoading()
			}
			
		})
	})
}

export default request